<ui:composition template="/layout.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:composite="http://java.sun.com/jsf/composite">

	<ui:define name="conteudo">

		<h1>Novo Livro</h1>

		<h:form>

			<h:panelGrid columns="3">

				<h:outputLabel value="#{msgs['titulo']}" for="inputTitulo" />
				<h:inputText required="true" id="inputTitulo"
					value="#{livroBean.livro.titulo}" />
				<h:message for="inputTitulo" />

				<h:outputLabel value="#{msgs['autor']}" for="inputAutor" />
				<h:inputText required="true" id="inputAutor"
					value="#{livroBean.livro.autor}" />
				<h:message for="inputAutor" />
				
				<h:outputLabel value="#{msgs['editora']}" for="inputEditora" />
				<h:inputText required="true" id="inputEditora"
					value="#{livroBean.livro.editora}" />
				<h:message for="inputEditora" />

				<h:outputLabel value="#{msgs['ano']}" for="inputAno" />
				<h:inputText label="Ano" required="true" id="inputAno"
					value="#{livroBean.livro.ano}">
				</h:inputText>
				<h:message for="inputAno" />
				
				<h:outputLabel value="#{msgs['edicao']}" for="inputEdicao" />
				<h:inputText label="Edicao" required="true" id="inputEdicao"
					value="#{livroBean.livro.edicao}">
				</h:inputText>
				<h:message for="inputEdicao" />

				<h:outputLabel value="#{msgs['categoria']}" for="selectCategoria" />
				<h:selectOneMenu id="selectCategoria"
					value="#{livroBean.livro.categoria}">
					 <f:selectItems value="#{livroBean.categorias}" />
				</h:selectOneMenu>
				<h:message for="selectCategoria" />
				
				<h:outputLabel value="#{msgs['ISBN']}" for="inputISBN" />
				<h:inputText label="ISBN" required="true" id="inputISBN"
					value="#{livroBean.livro.ISBN}">
				</h:inputText>
				<h:message for="inputISBN" />

				<h:outputLabel value="#{msgs['numPaginas']}" for="inputNumPaginas" />
				<h:inputText label="numPaginas" required="true" id="inputNumPaginas"
					value="#{livroBean.livro.numPaginas}">
				</h:inputText>
				<h:message for="inputNumPaginas" />
				
				<h:outputLabel value="#{msgs['numDescricao']}" for="inputDescricao" />
				<h:inputTextarea rows="4" label="Descricao" required="true" id="inputDescricao"
					value="#{livroBean.livro.descricao}">
				</h:inputTextarea>
				<h:message for="inputDescricao" />
				
				<h:outputLabel value="#{msgs['preco']}" for="inputPreco" />
				<h:inputText label="numPreco" required="true" id="inputPreco"
					value="#{livroBean.livro.preco}">
				</h:inputText>
				<h:message for="inputPreco" />
								
				<h:commandButton value="Cadastrar"
					action="#{livroBean.cadastrarLivro}" />

			</h:panelGrid>
			
		</h:form>

	</ui:define>

</ui:composition >
